package cn.kgc.easybuy.dao;

import cn.kgc.easybuy.pojo.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @program: yingzi-wants-to-sleep
 * @description:
 * @author: 敖成
 * @create: 2025-09-11 14:47
 **/
@Mapper
@Repository
public interface CategoryMapper {
    List<Category> selectAllCategory();

    List<Category> selectCategoryByPage(Map<String,Object> params);

    //查询所有子分类
    List<Category> selectChildren(Integer parentId);

    //查询所有一级分类
    List<Category> selectRootCategories();

    //查找下一级级标题
    List<Category> selectChildCategory(Integer id);


    int delCategory(Integer id);

    int addCategory(Category category);

    int updateCategory(Category category);

    Category selectCategoryById(Integer id);

    int checkName(@Param("name") String name, @Param("type") Integer type);

    List<Category> selectCategoryByType(Integer type);
}
